/**
 * @author Andrey Anisimov <hercules@inbox.ru>
 */

import core.effect.TimerEffect;

class Blink extends TimerEffect {

    /**
     * @param target {Object} Object implementing <code>setVisible(visible)</code> and <code>isVisible</code> methods.
     * @param duration {int} Effect duration, in milliseconds.
     * @param timer {core.util.Timer} Effect timer.
     * @constructor
     */
    this.Blink = function (target, duration, timer) {
        super(duration, timer);
        this.target = target;
        this.addEffectListener(this);
    };

    /**
     * @inheritDoc
     */
    this.onEffectFinished = function () {
        this.target.setVisible(true);
    };

    /**
     * @inheritDoc
     */
    this.playback = function () {
        this.target.setVisible(!this.target.isVisible());
    };
}